package net.sending;

import net.message.Message;
import net.Client;
import net.receiving.converter.Converter;

import java.net.Socket;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;

public class UDPUnicast implements UnicastMessage {

    private final Message message;
    private final Client client;

    public UDPUnicast(Message message, Client client){
        this.client = client;
        this.message = message;
    }

    public void send() {
        byte[] b = Converter.convertToByteArray(message);
        Util.sendUDPPacket(b, client.getIp());
    }

}